<?php
$email = "[email protected]";
$pattern = '#
(\w+)
@
(
\w+
( [\w \.] {2,6} )
)
#uix';
if(preg_match($pattern, $email, $matches))
{
echo 'name: ',$matches[1], PHP_EOL,
'domain: ', $matches[2], PHP_EOL,
'tld: ', $matches[3], PHP_EOL;
}
1